<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>

<%@page import="model.bean.Account"%>
<%@page import="common.Privilege"%>

<%@page import="java.util.ArrayList"%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Danh sách tài khoản</title>
	<!-- BOOTSTRAP STYLES-->
    <link href="${pageContext.request.contextPath}/assets/css/bootstrap.css" rel="stylesheet" />
     <!-- FONTAWESOME STYLES-->
    <link href="${pageContext.request.contextPath}/assets/css/font-awesome.css" rel="stylesheet" />
     <!-- MORRIS CHART STYLES-->
        <!-- CUSTOM STYLES-->
    <link href="${pageContext.request.contextPath}/assets/css/custom.css" rel="stylesheet" />
     <!-- GOOGLE FONTS-->
   <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
     <!-- TABLE STYLES-->
    <link href="${pageContext.request.contextPath}/assets/js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
	<style type="text/css">
		    			.question {
						position: absolute;
						display: inline;
						text-align: center;
						width: 174px;
						height: 78px;
						font-size: 13px;
						line-height: 1.5em;
						background: url('${pageContext.request.contextPath}/administrator/images/bubble.png') left top no-repeat;
						padding: 10px 0 0 0;
						text-shadow: 0px 1px 0px #fff;
						margin-left: -7em;
						margin-top: -6em;
						opacity: 0;
						}
						.yes{
						margin-top: .5em;
						margin-right: .5em;
						cursor: pointer;
						display: inline-block;
						width: 63px;
						height: 21px;
						color: #434d17;
						text-shadow: 0px 1px 0px #fff;
						background: url('${pageContext.request.contextPath}/administrator/images/buttony.png') left top no-repeat;
						}
						.cancel {
						margin-top: .5em;
						margin-right: .5em;
						cursor: pointer;
						display: inline-block;
						width: 63px;
						height: 21px;
						color: #fff;
						text-shadow: 0px 1px 0px #000;
						background: url('${pageContext.request.contextPath}/administrator/images/buttonn.png') left top no-repeat;
						}
	</style>
</head>
<body>
	<%	// Check Privilege
	Account account = (Account) session.getAttribute("account");
	if(account == null){
	    response.sendRedirect("../CheckPrivilegeServlet");
	}else{
	    if(account.getPrivilege() != Privilege.ADMIN){%>
	    	<jsp:include page="error.jsp"></jsp:include>
   		<%}else{
		ArrayList<Account> listAccount = (ArrayList<Account>) request.getAttribute("listAccount");
	%>
    <div id="wrapper">
    	<nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <a class="navbar-brand" href="#"></a>
            </div>
            <div style="color: rgb(255, 3, 23);
              padding:  15px 10px;
              float: left;
              width:  30%;
              font-size: 1.5em;"> 
              <marquee behavior="alternate">Da Nang Travel - Website quản trị</marquee>
            </div>
            <div style="color: white;
              padding: 15px 30px 15px 10px;;
              float: right;
              font-size: 16px;"> Xin chào admin:   &nbsp;   &nbsp;  &nbsp;  &nbsp; 
			<div class="btn-group" style = "margin-left: -20px;">
					<button class="btn btn-primary"><%= account.getName() %></button>
					<button data-toggle="dropdown"
						class="btn btn-primary dropdown-toggle">
						<span class="caret"></span>
					</button>
					<ul class="dropdown-menu">
						<li><a href="${pageContext.request.contextPath}/administrator/changepass.jsp">Thay đổi mật khẩu</a></li>
						<li><a href="${pageContext.request.contextPath}/administrator/profile.jsp">Xem thông tin cá nhân</a></li>
						<li class="divider"></li>
						<li><a href="${pageContext.request.contextPath}/LogoutServlet"> Thoát </a></li>
					</ul>
			</div>
			</div>
        </nav>
        <div id = "tier2">
        	<div id = "left">
           <!-- /. NAV TOP  -->
                <nav class="navbar-default navbar-side" role="navigation">
              	<div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
			        <li class="text-center">
			                    <img src="${pageContext.request.contextPath}/administrator/images/IMG_0865.JPG" class="user-image img-responsive"/>
			        </li>
                    <li>
                        <a class="active-menu"  href="${pageContext.request.contextPath}/administrator/profile.jsp"><i class="fa fa-home fa-3x"></i> Trang chủ</a>
                    </li>
                     <li>
                        <a  href="#"><i class="fa  fa-list-ul fa-3x"></i> Danh sách tài khoản </a>
                            <ul class="nav nav-second-level">
                            <li>
                                  <a href="${pageContext.request.contextPath}/ManageAccountServlet?action=getListAccount&code=0">Tất cả</a>
                              </li>
                              <li>
                                  <a href="${pageContext.request.contextPath}/ManageAccountServlet?action=getListAccount&code=1">Tài khoản quản trị</a>
                              </li>
                              <li>
                                  <a href="#" >> Tài khoản quản lý</a>
                                  <ul class="nav nav-third-level">
                                    <li>
                                       <a href="${pageContext.request.contextPath}/ManageAccountServlet?action=getListAccount&code=2">Quản lý tuor du lịch</a>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/ManageAccountServlet?action=getListAccount&code=3">Quản lý dịch vụ du lịch</a>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/ManageAccountServlet?action=getListAccount&code=4">Quản lý tin tức</a>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/ManageAccountServlet?action=getListAccount&code=5">Tiếp cận khách hàng</a>
                                    </li>
                                </ul>
                              </li>
                          </ul>
                    </li>
                    <li>
                        <a  href="${pageContext.request.contextPath}/administrator/addnewaccount.jsp"><i class="fa fa-plus-circle fa-3x"></i> Thêm tài khoản</a>
                    </li>
               </ul>
            </div>
        </nav>
        </div>
        <!-- /. NAV SIDE  -->
        <div id="right">
        <div id="page-wrapper" >
                        	<div class="panel-body">
	                            <div class="table-responsive">
	                            	<table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>Tên tài khoản</th>
                                            <th>Quyền</th>
                                            <th>Họ Tên </th>
                                            <th>Ngày Sinh</th>
                                            <th> SĐT </th>
                                            <th>Email </th>
                                            <th>Giới tính </th>
                                            <th></th>
                                            <th></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <% if (listAccount != null){
                                            for(Account acc : listAccount){
                                                %>
                                                <tr class="gradeU">
		                                            <td><%= acc.getNameAccount() %></td>
		                                            <td><%= acc.getDesAccount() %></td>
		                                            <td><%= acc.getName() %></td>
		                                            <td><%= acc.getDateOfBirth() %></td>
		                                            <td><%= acc.getPhoneNumber() %></td>
		                                            <td><%= acc.getEmail() %></td>
		                                            <td><% if(acc.isSex()) out.print("Nam"); else out.print("Nữ"); %></td>
                                        			<td><a href="${pageContext.request.contextPath}/ManageAccountServlet?action=editAccount&ID=<%= acc.getNameAccount() %>"><img src="${pageContext.request.contextPath}/administrator/images/user_edit.png" alt="Edit" title="" border="0"></a></td>
                                        			<td><a href="${pageContext.request.contextPath}/ManageAccountServlet?action=deleteAccount&ID=<%= acc.getNameAccount() %>" class="ask" ><img src="${pageContext.request.contextPath}/administrator/images/trash.png" alt="Edit" title="" border="0"></a></td>
                                        		</tr>
                                            <%}
                                        }
                                        %>
                                    </tbody>
                        </table> 
        		</div>
         	</div>
        </div> <!-- /. PAGE WRAPPER  -->
        </div>
</div>
        <div style="clear: both;"></div>
        <div id = "footer" >
		    <h3 style = "margin-top: 0px;">Da Nang Travel - Website Quản trị </h3>
		    Developed by: <a href="#">JAVA TEAM 03</a> 
	    </div> <!--  End #footer -->
</div> <!-- /. WRAPPER  -->
    <!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
    <!-- JQUERY SCRIPTS -->
    <script src="${pageContext.request.contextPath}/assets/js/jquery-1.10.2.js"></script>
      <!-- BOOTSTRAP SCRIPTS -->
    <script src="${pageContext.request.contextPath}/assets/js/bootstrap.min.js"></script>
    <!-- METISMENU SCRIPTS -->
    <script src="${pageContext.request.contextPath}/assets/js/jquery.metisMenu.js"></script>
     <!-- DATA TABLE SCRIPTS -->
    <script src="${pageContext.request.contextPath}/assets/js/dataTables/jquery.dataTables.js"></script>
    <script src="${pageContext.request.contextPath}/assets/js/dataTables/dataTables.bootstrap.js"></script>
    <script>
            $(document).ready(function () {
                $('#dataTables-example').dataTable();
            });
    </script>
    <script src="${pageContext.request.contextPath}/assets/js/jconfirmaction.jquery.js"></script>
    <script type="text/javascript">
		$(document).ready(function() {
			$('.ask').jConfirmAction();
		});
	</script>
         <!-- CUSTOM SCRIPTS -->
    <script src="${pageContext.request.contextPath}/assets/js/custom.js"></script>
    
 <% } }%>  
</body>
</html>
    